package com.coding.kan_yi_dao.controller;


import com.coding.kan_yi_dao.common.Result;
import com.coding.kan_yi_dao.entity.Carousel;
import com.coding.kan_yi_dao.service.impl.CarouselServiceImpl;
import com.coding.kan_yi_dao.service.impl.OssServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 砍一刀，不买就砍你一刀
 * @since 2023-09-20
 */
@Api(tags = "轮播图配置")
@RestController
@RequestMapping("/carousel")
@CrossOrigin
public class CarouselController {
    @Resource
    CarouselServiceImpl carouselService;

    @Resource
    OssServiceImpl ossService;

    //TODO 查询
    @ApiOperation(value = "全查询")
    @GetMapping("/go_select/carousel")
    public Result go_select() {
        return carouselService.go_select_carousel();
    }

    //TODO 新增轮播图
    @ApiOperation(value = "新增轮播图")
    @GetMapping("/go_insert/carousel")
    public Result go_insert(Carousel carousel) {
        return carouselService.go_insert(carousel);
    }

    //TODO 修改
    @ApiOperation(value = "修改")
    @GetMapping("/go_update/carousel")
    public Result go_update(Carousel carousel){
        return carouselService.go_update(carousel);
    }
    //TODO 删除
    @ApiOperation(value = "删除")
    @GetMapping("/go_delete/carousel")
    public Result go_delete(@RequestParam(value="ids",required=false) List<Integer> ids) {
        return carouselService.go_delete(ids);
    }
}
